//
//  E7GameDefine.h
//  E7_ENGINE
//
//  Created by cc on 12-2-29.
//  Copyright (c) 2012年 PalmGame. All rights reserved.
//

#ifndef E7_ENGINE_E7GameDefine_h
#define E7_ENGINE_E7GameDefine_h

#include "E7Externs.h"
#include "E7BaseExterns.h"
#include "E7UtilityExterns.h"
#include "E7EffectExterns.h"
#include "E7AnimationExterns.h"

#include "E7ADExterns.h"

/*
 * unit1 < (unit2 == tower) < unit3.
 * a none   cell add   2 golds.
 * a tree   cell add  -2 golds.
 * a stone  cell add  -2 golds.
 * a dead   cell add  -2 golds.
 * a unit1  cell add   0 golds.
 * a city1  cell add   0 golds.
 * a unit2  cell add - 8 golds.
 * a tower1 cell add   0 golds.
 * a unit3  cell add -20 golds.
 *
 * add a unit1  need  10 golds.
 * add a unit2  need  20 golds.
 * add a tower1 need  20 golds.
 * add a unit3  need  30 golds.
 *
 * a new town set default value with cell counts.
 * attach towns that add golds and rand add (0 - 10 )golds.
 *
 * attack a none  cell add    0 golds.
 * attack a tree  cell add    2 golds. (woods)
 * attack a stone cell add    2 golds. (stones)
 * attack a city1 cell add  10% the town golds.
 *
 * by attack city cell add -10% the town golds.
 *
 * init ---
 * a cell add  5 golds.
 * a tree add -3 golds.
 */

/*
 * turn manager.
 */


typedef enum 
{
    SS_ERROR = INVALID_INT,

    SS_LOGO = 0,
    SS_LOADING,
    SS_MENU,
    SS_STAGE,
    SS_GAME,

    SS_MAX,
} eSceneState ;

typedef enum
{
    UV_NONE = 0,
    UV_TREE = 1,
    UV_STONE,
    UV_DEAD,
    UV_SOLDIER_1,
    UV_CITY,
    UV_SOLDIER_2,
    UV_TOWER,
    UV_SOLDIER_3,
    UV_SOLDIER_MAX = UV_SOLDIER_3,
    UV_SOLDIER_NULL = UV_SOLDIER_MAX + 100,

} eUnitValue ;
const int UNIT_NEED_GOLD_ARRAY[] = {
    0, 0, 0, 0, 10, 0, 20, 20, 30, 30,
} ;

const int UNIT_IN_GOLD_ARRAY[] = {
    0, 0, 0, 0, 0, 0, -8, 0, -20, -20,
} ;

// ai.
typedef enum
{
    PT_ATTACK,
    PT_ATTACH,
    PT_MOVE,
} sProcessType ;
typedef struct
{
    int townid ;         // action townid.
    int tarcellid ;      // target cellid.
    int tartownid ;      // target townid.
    int tarcountryid ;   // target countryid.
    int cellvalue ;      // cell value.
    eUnitValue needuv ;  // action need unit value.
    sProcessType pt ;    // process type.
} sAIData ;
//////////////////////////////////////////////

// image info.
typedef struct 
{
    char  img[32] ;
    int   z ;
    int   tag ;
    float scale ;
    int   width ;
    int   height ;
    float initx ;
    float inity ;
} sImageInfo ;

const float MAP_INIT_X           = (75.0f + 512.0f) ;
const float MAP_INIT_Y           = 75.0f + 75.0f ;

//const float MAP_CELL_MAX         = 7 ;
const float MAP_CELL_WIDTH       = 90.0f ; //97.0f ;
const float MAP_CELL_HEIGHT      = 78.0f ; //84.0f ;
const float MAP_CELL_SCALE       = 0.3f ;
const float MAP_SPRITE_SCALE_X   = 2.0f * MAP_CELL_SCALE ;
const float MAP_SPRITE_SCALE_Y   = 2.0f * MAP_CELL_SCALE ;
const float MAP_CELL_RADIUS      = MAP_CELL_WIDTH * MAP_CELL_SCALE ;

const float MAP_UNIT_WIDTH       = 90.0f ; //90.0f ;
const float MAP_UNIT_HEIGHT      = 78.0f ; //78.0f ;
const int   MAP_INFO_MAX         = 5 ;

const float MAP_INIT_X_IPHONE           = (75.0f + 240.0f) ;
const float MAP_INIT_Y_IPHONE           = 75.0f + 75.0f ;

const float MAP_CELL_WIDTH_IPHONE       = 90.0f/2 ; //97.0f ;
const float MAP_CELL_HEIGHT_IPHONE      = 78.0f/2 ; //84.0f ;
const float MAP_CELL_SCALE_IPHONE       = 0.3f ;
const float MAP_SPRITE_SCALE_X_IPHONE   = 2.0f * MAP_CELL_SCALE ;
const float MAP_SPRITE_SCALE_Y_IPHONE   = 2.0f * MAP_CELL_SCALE ;
const float MAP_CELL_RADIUS_IPHONE      = MAP_CELL_WIDTH_IPHONE * MAP_CELL_SCALE_IPHONE ;

const float MAP_UNIT_WIDTH_IPHONE       = 90.0f/2 ; //90.0f ;
const float MAP_UNIT_HEIGHT_IPHONE      = 78.0f/2 ; //78.0f ;
const int   MAP_INFO_MAX_IPHONE         = 5 ;

const int CREATE_MAP_ARRAY[][4] ={
    { 17, 15, 10, 7, }, // 255, 70.
    { 23, 15, 15, 7, }, // 315, 105.
    { 29, 15, 20, 7, }, // 375, 140.

//    { 31, 23, 40, 7, }, // 273, 30, 7.
//    { 31, 23, 50, 7, }, // 273, 30, 7.
//    { 31, 23, 60, 7, }, // 273, 30, 7.

//    { 41, 33, 70, 7, }, // 273, 30, 7.
//    { 41, 33, 80, 7, }, // 273, 30, 7.
//    { 41, 33, 90, 7, }, // 273, 30, 7.
} ;

const int STAGE_COUNT = 18 ;

class CE7Unit ;
class CE7Cell ;
class CE7Town ;
class CE7Country ;
class CE7Map ;
class CE7Robot ;

typedef list<int> UNIT_ID_LIST ;
typedef list<int> CELL_ID_LIST ;
typedef list<int> TOWN_ID_LIST ;

typedef list<CE7Unit*>    UNIT_INFO_LIST ;
typedef list<CE7Cell*>    CELL_INFO_LIST ;
typedef list<CE7Town*>    TOWN_INFO_LIST ;
typedef list<CE7Country*> COUNTRY_INFO_LIST ;
typedef list<CE7Map*>     MAP_INFO_LIST ;
typedef list<CE7Robot*>   ROBOT_INFO_LIST ;

const int DIALOG_TAG = 10000 ;

/*
 * 音效:
 * LOGO         1 - 2秒.
 * 开场动画       3 - 5秒.
 
 * 特点: 欧洲, 中世纪, SLG,
 * 点击按钮       < 1秒.
 * 游戏开始       1 - 2秒.
 * 胜利          3 - 5秒.
 * 失败          2 - 3秒.
 * 攻击敌人领地    < 1秒. 
 * 攻击敌人士兵    < 1秒.
 * 攻击敌人城市    < 1秒.
 * 攻击树木       < 1秒.
 * 每回合金钱结算  < 1秒.
 * 不可操作提示音  < 1秒.
 */

// resource name. iPhone or iPad.
// logo.
const char logo_e7click_none[]        = "e7click_none.png" ;

// loading.
const char loading_back_n[]           = "back_loading_n.png" ;
const char loading_back_s[]           = "back_loading_s.png" ;


// iphone.
const char logo_e7click_none_iphone[] = "e7click_none_iphone.png" ;
const char loading_back_n_iphone[]    = "back_loading_n_iphone.png" ;
const char loading_back_s_iphone[]    = "back_loading_s_iphone.png" ;

static bool s_bPlaySound = true ;
const char sound_attack_city[]    = "attack_city.mp3" ;
const char sound_attack_soldier[] = "attack_soldier.mp3" ;
const char sound_attack_wood[]    = "attack_wood.mp3" ;
const char sound_button[]         = "button.mp3" ;
const char sound_money[]          = "money.mp3" ;
const char sound_unconsid[]       = "unconsid.mp3" ;
const char sound_win[]            = "win.mp3" ;

#endif









